package co.yixiang.modules.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @author lww
* @date 2020-10-22
*/
@Data
@Accessors(chain = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("g_store_share_income")
public class ShareIncome implements Serializable {

    /** 主键 */
    @TableId
    private Integer id;


    /** 商铺唯一主键 */
    @NotBlank
    private String storeUnique;


    /** 订单号 */
    @NotBlank
    private String orderNumber;


    /** 分润比例 */
    @NotNull
    private BigDecimal storeScale;


    /** 分润前的金额 */
    private BigDecimal beforeMoney;


    /** 收入金额，即分润后金额 */
    private BigDecimal money;


    /** 创建时间 */
    private LocalDateTime createTimes;


    /** 更新时间 */
    private LocalDateTime updateTimes;


    public void copy(ShareIncome source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
